<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title></title>
    <script src="jquery.js"></script>
    <script type="text/javascript">

    $(function(){
      $('#btn1').click(function(){
        $.ajax({
          url: '1.php',
          method: 'post',
          data: {
            a: $('#txt1').val(),
            b: $('#txt2').val()
          },
          success(res){
            alert(res);
          },
          error(){
            alert('error');
          }
        });
      });
    });
    </script>
  </head>
  <body>
      <input type="text" name="a" value="" id="txt1">
      <input type="text" name="b" value="" id="txt2">
      <input type="button" name="" value="提交" id="btn1">

  </body>
</html>
